package com.pzr.soccer.rabbit.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author :
 * @CreateTime :
 * @Description :
 **/

@Configuration
public class RabbitConfig {
    public final static String Queue_Plan_Match_Message_ForWeb= "Queue_Plan_Match_Message_ForWeb";
    public final static String Queue_Plan_Match_Message_ForMail= "Queue_Plan_Match_Message_ForMail";
    public final static String Queue_Plan_Match_Message_ForMsgText= "Queue_Plan_Match_Message_ForMsgText";
    public final static String FanoutExChange_Plan_Match_Message= "FanoutExChange_Plan_Match_Message";


    @Bean
    public Queue planMatchMessageQueueToWeb() {
        return new Queue(Queue_Plan_Match_Message_ForWeb);
    }

    @Bean
    public Queue planMatchMessageQueueToMail() {
        return new Queue(Queue_Plan_Match_Message_ForMail);
    }

    @Bean
    public FanoutExchange planMatchMessageExchange(){
        return new FanoutExchange(FanoutExChange_Plan_Match_Message);
    }

    @Bean
    public Binding bindPlanMatchMessageExchangeToQueueForWeb(){
        return BindingBuilder.bind(planMatchMessageQueueToWeb()).to(planMatchMessageExchange());
    }

    @Bean
    public Binding bindPlanMatchMessageExchangeToQueueForMail(){
        return BindingBuilder.bind(planMatchMessageQueueToMail()).to(planMatchMessageExchange());
    }
}
